% by clq sby wwb ylx
addpath functions;

% 将论文假定的常数设置为全局变量，免去不必要的参数
% >>> global variables settings
global P J I ci cI r LAMBDA CURRENT 
% P = [.1, .5, .9]; % for test only
LAMBDA = 3; % lambda * dt 
ci=40; cI=200; r=100;
J = 3; I = 8;
% end global settings <<<

load('j_all_all.mat'); 
% size(j_all_all) = 1000*48 
% 首行为论文数据
N = size(j_all_all, 2); % N为需要计算到的call数，根据需求取
genPoisson(N);

j_all = j_all_all(1, :); % 根据选择j_all中的第几行，此处选择第一行



%--------------------------------figures--------------------------------%

QUICK_RUN = true; % 如需跳过时间很长的图，设为true；如希望运行完整程序设为false


%figure 2
disp('--> Figure 2 Runing ...');
figure2(j_all, N);  % P = [.1, .5, .9]

%figure 3 4
disp('--> Figure 3 & 4 Runing ...');
figure3_4(j_all, N);  % P = [.1, .5, .9]

%figure 5 9 16
% >>> recommanded 
if ~ QUICK_RUN
    disp('--> Figure 5 & 9 & 16');
    load('LINE_2500.mat');
    Simu_Figure5(LINE_2500); % P=(.25, .5, .75)
end

% figure 6
disp('--> Figure 6');
figure6(j_all, N); % P=(0.25,0.5,0.75)

% figure 7
disp('--> Figure 7');
figure7(j_all, N); % P=(0.25,0.5,0.9)

% figure 8
disp('--> Figure 8');
figure8(j_all, N);

% figure 10 12 14 
if ~ QUICK_RUN
    global s_time
    P = [.25, .5, .75];
    genPIE(N);
    s_time = ftimer();
    disp('--> Figure 10 & 12 & 14');
    figure1x_even(j_all_all);
    % input("-->> Press ENTER to continue.\n"); % 暂停程序

    % figure 11 13 15 
    s_time = ftimer();
    disp('--> Figure 11 & 13 & 15');
    figure1x_odd(j_all_all);
    % input("-->> Press ENTER to continue.\n"); % 暂停程序
end 
